package com.xg.controller;


import com.xg.common.result.ApiResult;
import com.xg.entity.UsedCar;
import com.xg.entity.UsedCarBrand;
import com.xg.service.IUsedCarBrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author jdh
 * @since 2023-03-30
 */
@Controller
@RequestMapping("/usedCarBrand")
public class UsedCarBrandController {

    @Autowired
    private IUsedCarBrandService iUsedCarBrandService;

    /**
     * @return com.xg.common.result.ApiResult<java.util.List < com.xg.entity.UsedCarBrand>>
     * @Author 罗迎庆
     * @Methodname queryUsedCarBrandPageList
     * @Description //TODO (汽车品牌查询)
     * @Date 19:15 2023/3/30
     * @Param []
     **/
    @RequestMapping("queryUsedCarBrandPageList")
    public String queryUsedCarBrandPageList(Model model, UsedCarBrand usedCarBrand) {
        List<UsedCarBrand> list = iUsedCarBrandService.queryUsedCarBrandPageList(usedCarBrand);
        model.addAttribute("brandList1", list);
        return "PurchaseCar";
    }

    /**
     * @return java.lang.String
     * @Author 罗迎庆
     * @Methodname queryUsedCarBrandById
     * @Description //TODO (汽车品牌根据id查询)
     * @Date 0:56 2023/4/5
     * @Param [BrandId]
     **/
    @RequestMapping("queryUsedCarBrandById")
    public String queryUsedCarBrandById(Model model,@RequestParam("brandId") Integer brandId) {
        List<UsedCar> usedCarBrandList = iUsedCarBrandService.queryUsedCarBrandById(brandId);
        model.addAttribute("usedCarBrandList", usedCarBrandList);
        return "PurchaseCar";
        
    }

}
